package com.jingfu.dto;

import lombok.Data;

import java.util.*;

@Data
public class SysPowerDTO {
    private String powerId;

    private String powerName;

    private String powerType;

    private String powerCode;

    private String powerUrl;

    private String openType;

    private String parentId;
    /**
     * 所有子菜单
     */
    private List<SysPowerDTO> childrenSysPowers = new ArrayList<>();

    private String icon;

    private Integer sort;

    private String remark;


    /**
     * 用户前端渲染菜单层级
     */
    @Data
    public static class MenuDTO{
        private String id;
        private String title;
        private String icon;
        private String type;
        private String href;
        private String openType;
        private String parentId;
        private Integer sort;
        private String checkArr = "0";

        /**
         * 所有子菜单
         */
        private List<MenuDTO> children = new ArrayList<>();

        public MenuDTO(SysPowerDTO sysPowerDTO) {
            this.title = sysPowerDTO.getPowerName();
            this.icon = sysPowerDTO.getIcon();
            this.type = sysPowerDTO.getPowerType();
            this.href = sysPowerDTO.getPowerUrl();
            this.openType = sysPowerDTO.getPowerUrl();
            this.sort = sysPowerDTO.getSort();
            this.parentId = sysPowerDTO.getParentId();
            this.id = sysPowerDTO.getPowerId();
        }
    }
}
